﻿namespace Sai.Core.Reporting
{
    using System;
    using System.IO;

	/// <summary>
	/// Generates report output as Sandcastle friendly MAML documents.
	/// </summary>
	public class MamlReportFormatter : IReportFormatter
	{
		public string Extension
		{
			get { return ".aml"; }
		}

		public void Execute(IFlattenToXml flattenable, IReportTransformation transformation, IReportOutput output)
		{
            try
            {
                string maml = transformation.Transform(flattenable);
                output.Execute(maml);
            }
            catch (Exception ex)
            {
                throw new ReportGenerationException(string.Format("Error generating MAML format report {0}", output.Path), ex);
            }
        }
	}
}
